home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #1 / Ham Radio 2000.iso / ham2000 / tcp_ip / wnos / wn941101 / enetdump.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-10  |  796 b   |  41 lines

  1. #include "global.h"
  2. #include "config.h"
  3. #ifdef ETHER
  4. #include "mbuf.h"
  5. #include "enet.h"
  6. #include "trace.h"
  7.  
  8. void
  9. ether_dump(FILE *fp,struct mbuf **bpp,int check)
  10. {
  11.     struct ether ehdr;
  12.     char s[20], d[20];
  13.  
  14.     ntohether(&ehdr,bpp);
  15.     trprintf(fp,"Ether: len %u %s->%s type ",
  16.         ETHERLEN + len_p(*bpp),pether(s,ehdr.source),pether(d,ehdr.dest));
  17.  
  18.     switch(ehdr.type){
  19.     case IP_TYPE:
  20.         trprintf(fp,"IP\n");
  21.         ip_dump(fp,bpp,1);
  22.         break;
  23.     case ARP_TYPE:
  24.     case REVARP_TYPE:
  25.         trprintf(fp,"%sARP\n",(ehdr.type == ARP_TYPE) ? "" : "REV");
  26.         arp_dump(fp,bpp);
  27.         break;
  28.     default:
  29.         trprintf(fp,"0x%x\n",ehdr.type);
  30.         break;
  31.     }
  32. }
  33.  
  34. int
  35. ether_forus(struct iface *iface,struct mbuf *bp)
  36. {
  37.     /* Just look at the multicast bit */
  38.     return (*bp->data & 1);
  39. }
  40.  
  41. #endif /* ETHER */